package com.lsiyun.sync_file.protocol;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@Accessors(chain = true)
public class SyncMessage implements Serializable {

    private int type;
    private SyncFile syncFile;

    public static SyncMessage generateMessage4C2S_GetSyncFileInfo() {
        // SyncMessage res = new SyncMessage();
        // res.setType(SyncProtocol.C2S_GET_FILES_INFO);
        // return res;

        return new SyncMessage().setType(SyncProtocol.C2S_GET_FILES_INFO);
    }

    public static SyncMessage generateMessage4C2S_DELETE(SyncFile syncFile) {
        return new SyncMessage().setType(SyncProtocol.C2S_DELETE_FILE).setSyncFile(syncFile);
    }

    public static SyncMessage generateMessage4C2S_ADD(SyncFile localFile) {
        return new SyncMessage().setType(SyncProtocol.C2S_ADD_FILE).setSyncFile(localFile);
    }

    public static SyncMessage generateMessage4C2S_GET_FILE(SyncFile remoteFile) {
        return new SyncMessage().setType(SyncProtocol.C2S_GET_FILE).setSyncFile(remoteFile);
    }

    public static SyncMessage generateMessage4C2S_UPDATE_TIME(SyncFile localFile) {
        return new SyncMessage().setType(SyncProtocol.C2S_UPDATE_TIME).setSyncFile(localFile);
    }
}
